import { SelectControlSchema } from 'amis/lib/renderers/Form/Select'

class YesOrNoSelectUtils {
	getSchema = (parmas?: Partial<SelectControlSchema>): SelectControlSchema => {
		const name = parmas?.name
		const label = parmas?.label
		const options = [
			{
				label: '是',
				value: true,
			},
			{
				label: '否',
				value: false,
			},
		]

		const mergeSchema = Object.assign(
			{
				type: 'select',
				name: name,
				label: label,
				clearable: true,
				options: options,
			},
			parmas,
		)

		const schema = mergeSchema as SelectControlSchema
		return schema
	}
}

export default new YesOrNoSelectUtils()
